package com.lxh.lxhcrm.model.pojos;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

/**
 * 维修工单表
 */
@Entity
public class Workord {
    private int workordId;
    private Date takeTime;
    private String workTest;
    private String linkWay;
    private String weiState;
    private Integer check;

    private Emp emp;
    private Customer customer;
    private Contact linkMan;

    @ManyToOne
    @JoinColumn(name = "emp_id")
    public Emp getEmp() {
        return emp;
    }

    public void setEmp(Emp emp) {
        this.emp = emp;
    }

    @ManyToOne
    @JoinColumn(name = "customer_id")
    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }


    @ManyToOne
    @JoinColumn(name = "link_man")
    public Contact getLinkMan() {
        return linkMan;
    }

    public void setLinkMan(Contact linkMan) {
        this.linkMan = linkMan;
    }



    @Id
    @Column(name = "workord_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public int getWorkordId() {
        return workordId;
    }

    public void setWorkordId(int workordId) {
        this.workordId = workordId;
    }

    @Basic
    @Column(name = "take_time", nullable = true)
    public Date getTakeTime() {
        return takeTime;
    }

    public void setTakeTime(Date takeTime) {
        this.takeTime = takeTime;
    }

    @Basic
    @Column(name = "work_test", nullable = true, length = 200)
    public String getWorkTest() {
        return workTest;
    }

    public void setWorkTest(String workTest) {
        this.workTest = workTest;
    }

    @Basic
    @Column(name = "link_way", nullable = true, length = 40)
    public String getLinkWay() {
        return linkWay;
    }

    public void setLinkWay(String linkWay) {
        this.linkWay = linkWay;
    }

    @Basic
    @Column(name = "wei_state", nullable = true, length = 40)
    public String getWeiState() {
        return weiState;
    }

    public void setWeiState(String weiState) {
        this.weiState = weiState;
    }

    @Basic
    @Column(name = "check_state", nullable = true)
    public Integer getCheck() {
        return check;
    }

    public void setCheck(Integer check) {
        this.check = check;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Workord workord = (Workord) o;
        return workordId == workord.workordId &&
                takeTime.equals(workord.takeTime) &&
                workTest.equals(workord.workTest) &&
                linkWay.equals(workord.linkWay) &&
                weiState.equals(workord.weiState) &&
                check.equals(workord.check) &&
                emp.equals(workord.emp) &&
                customer.equals(workord.customer) &&
                linkMan.equals(workord.linkMan);
    }

    @Override
    public int hashCode() {
        return Objects.hash(workordId, takeTime, workTest, linkWay, weiState, check, emp, customer, linkMan);
    }
}
